<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017\10\25 0025
 * Time: 10:01
 */

namespace app\api\model;


class Respont
{
    protected  $obj ;
    protected  $user ;
    protected  $fromName ;
    protected  $msgType ;
    protected  $event ;
    protected  $data ;

    public function __construct($obj)
    {
        $this->obj = $obj ;
        $this->user = $obj->FromUserName ;
        $this->fromName= $obj->ToUserName ;
        $this->msgType = $obj->MsgType ;
        $this->data = "
         <xml>
         <ToUserName><![CDATA[%s]]></ToUserName>
         <FromUserName><![CDATA[%s]]></FromUserName>
         <CreateTime>%s</CreateTime>
         <MsgType><![CDATA[%s]]></MsgType>
        ";

    }
    public function text_return($content)
    {
        $data =$this->data."<Content><![CDATA[%s]]></Content></xml>";
        $date = 2012;
        return sprintf($data ,$this->user,$this->fromName,$date,'text',$content);
    }
}